// 导入组件
import Vue from 'vue';
import Router from 'vue-router';

// 导入工具类
import { getStore } from "@/utils/util";
import { TOKEN } from '@/utils/const';

// ==================================== 公有页面 ==================================== 
// 登录、404
const Login = () => import('@/views/public/Login');
const NotFound = () => import('@/views/public/Page404');

// 启用路由 「路由注册」
Vue.use(Router);

// 定义路由列表
const routes = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    desc: "登录",
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
      requireAuth: false
    }
  },
  {
    desc: "错误页面",
    path: '*',
    component: NotFound,
  }
];

// 创建路由对象
const router = new Router({
  mode: 'history',
  routes
});

// 配置路由拦截器
router.beforeEach((to, from, next) => {
  // ...
  next();
})

// 导出路由信息
export default router;
